<template>
    <div class="select-unit">
        <v-down @returnChecked="getValue" :margin="margin" :total="total" :dataList="dataList"></v-down>
        <div class="switchContainer" >
            <mt-switch v-model="onoffice" @change="change_onoffice">正职</mt-switch>
            <mt-switch v-model="offoffice" @change="change_offoffice">退居二线</mt-switch>
            <mt-switch v-model="retire" @change="change_retire">内部退养</mt-switch>
        </div>
    </div>
</template>
<script>
import downSel from '@/components/public/downSel'
export default {
  data(){
      return{
          onoffice:false,
          offoffice:false,
          retire:false,
      }
  },
  components:{
    'v-down':downSel
  },
  props:{
    dataList:{
      type:Array
    },
    total:{
      type:Number
    },
    margin:{
      type:Boolean
    }
  },
  methods:{
    change_onoffice:function(val){
      if (this.onoffice) {this.offoffice=false; this.retire=false;}
      this.$emit("getValue","onoffice",val)
    },
    change_offoffice:function(val){
      if (this.offoffice) {this.onoffice=false; this.retire=false;}
      this.$emit("getValue","offoffice",val)
    },
    change_retire:function(val){
      if (this.retire) {this.onoffice=false; this.offoffice=false;}
      this.$emit("getValue","retire",val)
    },
    getValue:function(val){
      console.log(val,"getValue")
      this.$emit('returnChecked',val)
    }
  }
}
</script>
<style scoped>
.select-unit{
  padding:0.1rem 0.2rem 0rem 0.2rem;
  
  height:1.62rem;
  background-color:#f3f3f3;
}
.select-unit > div{
  background-color:#fff;
}
.select-unit>div.switchContainer{
  display: flex;
  -webkit-box-align: center;
    -ms-flex-align: center;
        align-items: center;
  position: relative;
}
.select-unit>div.uint-header{
  line-height:0.72rem;
  height:0.72rem;
  position: relative;
}
.select-unit .switchContainer{
  height:0.8rem;
  padding-left:0.4rem;
  padding-right:0.4rem;
}
.select-unit .uint-header{
  height:0.72rem;
}
.select-unit .uint-header img{
  width:0.28rem;
  height:0.28rem;
}
</style>

